home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tjoop11.zip / BASETYPE.PAS next >
Pascal/Delphi Source File  |  1991-05-17  |  5KB  |  174 lines

  1. UNIT BaseTypes ;
  2.  
  3.  
  4.  
  5.  
  6. {**********************************************************************
  7.  *                                                                    *
  8.  *  PROGRAM :  BaseTypes               PC FILE NAME :  BASETYPE.PAS   *
  9.  *  ----------------------------------------------------------------  *
  10.  *  LIBRARY MODULES USED :  DOS CRT                                   *
  11.  *  Objects  :  TP6.0 TPU SOURCE: OBJECTS .PAS  BINARY:  OBJECTS .TPU *
  12.  *  ----------------------------------------------------------------  *
  13.  *  PURPOSE :  The purpose of this UNIT is to provide Base objects    *
  14.  *             to construct polymophic objects from.                  *
  15.  *  ----------------------------------------------------------------  *
  16.  *  AUTHOR   :  Thomas E. Jenkins, Jr.                                *
  17.  *              PROGRAMMER, UNIVERSITY OF SOUTH CAROLINA, USA         *
  18.  *  BITNET   :  C0361@UNIVSCVM.BITNET                                 *
  19.  *  INTERNET :  C0361@univscvm.csd.scarolina.EDU                      *
  20.  *              tomj@csdserver3.csd.scarolina.EDU                     *
  21.  *  ----------------------------------------------------------------  *
  22.  *  DISCAIMER :  This program has been tested to the best of my       *
  23.  *               abilities.  The author claims no responsibility      *
  24.  *               for the performance or side effects this program     *
  25.  *               may yield.                                           *
  26.  *  ----------------------------------------------------------------  *
  27.  *  DISTIBUTION :  This program is given freely to the PD realms.     *
  28.  *                 It may freely be copied and distributed.  Any      *
  29.  *                 one wishing to use some or whole parts of this     *
  30.  *                 program for commercial use please contact the      *
  31.  *                 author first.                                      *
  32.  *                                                                    *
  33.  **********************************************************************}
  34.  
  35.  
  36.  
  37.  
  38.                                   INTERFACE
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.              {
  46.  
  47.  
  48.                  Here is a basic view of the Base object tree:
  49.  
  50.                  TObject                    [ to allow use with streams   ]
  51.                     |
  52.                     |
  53.                     \___ TBaseOBJ           [ basic functions of structs  ]
  54.                              |              [ & elements                  ]
  55.                              |
  56.                              \___ TElementOBJ    [ basic functionality of ]
  57.                                                  [ any element            ]
  58.  
  59.              }
  60.  
  61.  
  62. USES
  63.        Objects ;                         {  For the base TYPE TObject  }
  64.  
  65.  
  66.  
  67.  
  68. TYPE
  69.  
  70.        PBaseOBJ                        = ^TBaseOBJ ;
  71.        TBaseOBJ                        = OBJECT ( TObject )
  72.  
  73.          DESTRUCTOR  Done ;              {  Ensure all derived objects  }
  74.            VIRTUAL ;                     {  WILL have a Done method     }
  75.  
  76.          END ;  {  TBaseOBJ  }
  77.  
  78.  
  79.  
  80.        PElementOBJ                     = ^TElementOBJ ;
  81.        TElementOBJ                     = OBJECT ( TBaseOBJ )
  82.  
  83.          last                          : PElementOBJ ;
  84.          next                          : PElementOBJ ;
  85.  
  86.          CONSTRUCTOR Init ;
  87.  
  88.          FUNCTION    TheType           : WORD ;
  89.            VIRTUAL ;
  90.  
  91.          PROCEDURE   Display ;           {  Mainly included for testing }
  92.            VIRTUAL ;
  93.  
  94.          FUNCTION    GetData           : POINTER ;
  95.            VIRTUAL ;
  96.  
  97.          PROCEDURE   SetData (     d   : POINTER ) ;
  98.            VIRTUAL ;
  99.  
  100.          END ;  {  TElementOBJ  }
  101.  
  102.  
  103.  
  104.  
  105.                                 IMPLEMENTATION
  106.  
  107.  
  108.  
  109.  
  110.  DESTRUCTOR  TBaseOBJ.Done ;
  111.  
  112.    BEGIN  {  TBaseOBJ.Done  }
  113.      END ;  {  TBaseOBJ.Done  }
  114.  
  115.  
  116.  
  117.  
  118.  CONSTRUCTOR TElementOBJ.Init ;
  119.  
  120.    BEGIN  {  TElementOBJ.Init  }
  121.  
  122.      last := NIL ;
  123.      next := NIL ;
  124.  
  125.      END ;  {  TElementOBJ.Init  }
  126.  
  127.  
  128.  
  129.  
  130.  FUNCTION    TElementOBJ.TheType       : WORD ;
  131.  
  132.    BEGIN  {  TBaseOBJ.TheType  }
  133.  
  134.      TheType := 0 ;                         {  0 = abstract type.     }
  135.  
  136.      END ;  {  TBaseOBJ.TheType  }
  137.  
  138.  
  139.  
  140.  
  141.  PROCEDURE   TElementOBJ.Display ;
  142.  
  143.    BEGIN  {  TBaseOBJ.Display  }
  144.  
  145.      Halt ( 12 ) ;                          {  ABSTRACT call Halt if  }
  146.                                             {  Not re-defined !!      }
  147.      END ;  {  TBaseOBJ.Display  }
  148.  
  149.  
  150.  
  151.  
  152.  FUNCTION    TElementOBJ.GetData       : POINTER ;
  153.  
  154.    BEGIN  {  TBaseOBJ.GetData  }
  155.  
  156.      Halt ( 12 ) ;                          {  ABSTRACT call Halt if  }
  157.                                             {  Not re-defined !!      }
  158.      END ;  {  TBaseOBJ.GetData  }
  159.  
  160.  
  161.  
  162.  
  163.  PROCEDURE   TElementOBJ.SetData (     d : POINTER ) ;
  164.  
  165.    BEGIN  {  TBaseOBJ.SetData  }
  166.  
  167.      Halt ( 12 ) ;                          {  ABSTRACT call Halt if  }
  168.                                             {  Not re-defined !!      }
  169.      END ;  {  TBaseOBJ.SetData  }
  170.  
  171.  
  172.  
  173.  
  174. END .